<!doctype html>
<html lang="zn-en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="__STATIC__/index/lib/css/bootstrap.css"  crossorigin="anonymous">
    <link rel="stylesheet" href="__STATIC__/index/css/login.css">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <title>登录</title>
</head>
<body>
<div class="main">
    <div class="title">
        <span class="b-tit">MHK</span>
        <span class="s-tit">国语在线推广学习平台</span>
    </div>
    <div class="content">
        <div class="cont-form">
            <span class="tit">用户登陆</span>
            <span class="s-tit">UserLogin</span>
            <form action="" method="post">
                <div class="input-list">
                    <i class="iconfont">&#xe630;</i>
                    <input type="text" name="user_name" placeholder="手机号">
                </div>
                <div class="input-list">
                    <i class="iconfont">&#xe627;</i>
                    <input type="password" name="user_password" placeholder="密码">
                </div>
                <button type="button" id="sub">登录</button>
                <a href="{:url('index/login/reg')}">注册</a>
            </form>
        </div>
    </div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="__STATIC__/index/lib/js/bootstrap.bundle.js" crossorigin="anonymous"></script>
<script src="__STATIC__/index/lib/js/bootstrap.js"  crossorigin="anonymous"></script>
<script type="text/javascript" src="__STATIC__/layui/layui.all.js"></script>
<script>
    layui.use('layer', function(){
        var layer = layui.layer;
    });
    $('#sub').click(function () {
        var phone=$("input[name='user_name']").val();
        var pwd=$("input[name='user_password']").val();
        if(phone=="" || pwd==""){
            layer.msg("请填写手机号和密码",{icon:2});
        }else {
            $.post("{:url('index/login/login')}",{user_name:phone,user_password:pwd},function (res) {
                if(res.code){
                    layer.msg("登陆成功",{icon:1});
                    setTimeout(function () {
                        window.location.href="{:url('index/index/index')}"
                    },500)
                }else {
                    layer.msg(res.msg,{icon:2});
                }
            })
        }
    })
</script>
</body>
</html>